<!DOCTYPE HTML>
<html>
    <head>
        <!-- meta -->
        <!-- meta -->
        <title>Integration with jQuery Templates</title>
        <!-- css -->
        <link href="../styles/examples.css" rel="stylesheet"/>
        <link href="../../source/styles/kendo.common.css" rel="stylesheet"/>
        <link href="../../source/styles/kendo.kendo.css" rel="stylesheet"/>
        <!-- css -->
        <!-- script -->
        <script src="../js/jquery.js"></script>
        <script src="../../source/js/kendo.core.js"></script>
        <script src="../../source/js/kendo.data.js"></script>
        <script src="../../source/js/kendo.data.odata.js"></script>
        <script src="../../source/js/kendo.popup.js"></script>
        <script src="../../source/js/kendo.list.js"></script>
        <script src="../../source/js/kendo.dropdownlist.js"></script>
        <script src="../../source/js/kendo.grid.js"></script>
        <script src="./jquery.tmpl.js"></script>
        <script src="./knockout-1.2.1.js"></script>
        <!-- script -->
    </head>
    <body>
        <!-- nav -->
        <!-- nav -->
        <!-- description -->
        <div class="description">This example shows how you can use a jQuery template to customize the appearance of Kendo UI widgets.</div>
        <!-- description -->
        <div id="example" class="k-content">
            <select id="netflixDropDown" style="width:500px"></select>

            <table id="netflixTable">
                <thead>
                    <tr>
                        <th>
                            Cover
                        </th>
                        <th>
                            Title
                        </th>
                        <th>
                            Rating
                        </th>
                    </tr>
                </thead>
                <tbody>
                    <tr>
                        <td colspan="3"></td>
                    </tr>
                </tbody>
            </table>

            <style scoped="scoped">

            .k-grid
            {
                margin-top:1.6em;
            }

            </style>

            <script id="dropDownTemplate" type="text/x-jquery-tmpl">
                <img src="${ BoxArt.SmallUrl }" alt="${ Name }" /> ${ Name }
            </script>
            <script id="rowTemplate" type="text/x-jquery-tmpl">
                <tr>
                    <td>
                        <img src="${ BoxArt.SmallUrl }" alt="${ Name }" />
                    </td>
                    <td>
                        ${ Name }
                    </td>
                    <td>
                        ${ AverageRating }
                    </td>
                </tr>
            </script>
            <script>
                $(document).ready(function() {
                    var dataSource = new kendo.data.DataSource({
                        type: "odata",
                        serverFiltering: true,
                        filter: [{
                            field: "Name",
                            operator: "contains",
                            value: "Star Wars"
                            },{
                            field: "BoxArt.SmallUrl",
                            operator: "neq",
                            value: null
                        }],
                        transport: {
                            read: "http://odata.netflix.com/Catalog/Titles"
                        }
                    });

                    $("#netflixTable").kendoGrid({
                        dataSource: dataSource,
                        rowTemplate: $.template($("#rowTemplate")),
                        height: 200
                    });

                    $("#netflixDropDown").kendoDropDownList({
                        dataTextField: "Name",
                        dataValueField: "Id",
                        template: $.template($("#dropDownTemplate")),
                        dataSource: dataSource
                    });
                });
            </script>
        </div>
        <!-- tools -->
        <!-- tools -->
    </body>
</html>
